/**
  ******************************************************************************
  * @author     Chris
  * @since      2024/6/28 15:40
  *
  * @file       pd_wwdg.h
  * @brief      Header file of Xxx hardware driver.
  *
  * @note       This file contains the Xxx object declaration.
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date          Author       Notes
  *   2024/6/28     Chris        the first version
  *
  ******************************************************************************
  */


#ifndef JLC_SKY_WWDG_H
#define JLC_SKY_WWDG_H

#include "pd_wdg.h"
#include "drivers.h"

typedef struct WinWDGDef WinWDG;

struct WinWDGDef {
    WDG wdg;

    WWDG_TypeDef *WWDGx;
    uint32_t Prescaler; // div 1, 2, 4, 8
    uint32_t Window;    // W[5:0]
    uint32_t Counter;   // T[5:0]

    uint32_t max;       // max window time, watchdog timeout, milliseconds
    uint32_t min;       // min window time, window time, milliseconds
};

extern const struct WinWDGClass {
    WinWDG *(*build)(WWDG_TypeDef *WWDGx, uint32_t Prescaler, uint32_t maxTimeout, uint32_t minTimeout);
} WinWDGBuilder;

#endif //JLC_SKY_WWDG_H
